import Vue from 'vue'
import VueRouter from 'vue-router'
import MainFrame from "@/views/MainFrame";
import Admin from "@/views/Admin";
import Home from "@/views/Home";
import Category from "@/views/Category";
import User from "@/views/User";
import Orders from "@/views/Orders";
import Goods from "@/views/Goods";
import Login from "@/views/Login";
import AddOrders from "@/views/AddOrders";

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'mainFrame',
    component: MainFrame,
    redirect: "/login",
    children: [
      { path: 'home', name: '首页', component: Home},
      { path: 'admin', name: '管理员列表', component: Admin},
      { path: 'category', name: '商品类别', component: Category},
      { path: 'user', name: '用户管理', component: User},
      { path: 'orders', name: '订单管理', component: Orders},
      { path: 'goods', name: '商品管理', component: Goods},
      { path: 'addorders', name: '添加订单', component: AddOrders},
    ]
  },{
    path: '/login',
    name:'登录',
    component: Login,
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
